import React from "react";
import { useNavigate, Link } from 'react-router-dom'
import { Card, Toast, Button } from "antd-mobile";

import style from "../css/Home.module.css";
import { AntOutline, RightOutline } from "antd-mobile-icons";
import styles from "../css/demo1.less";
import { Divider } from "antd-mobile";
import { Image, Space } from "antd-mobile";
import { Grid } from "antd-mobile";
import { Ellipsis } from "antd-mobile";
import { Rate } from 'antd-mobile'
export default ({ hoplist }) => {
    const navigate = useNavigate();
  const btn1 = (id) => {
    // Toast.show(id);
      console.log(id);//动态路由
      navigate(`/house/${id}`)
      
  };
  return (
    <div>
      {/* <Card onClick={onClick}>
        <div>
          <Grid columns={3} gap={8}>
            <Grid.Item>
              <img
                src={"/api" + hoplist[0]?.imgUrl}
                className={style.img}
              ></img>
            </Grid.Item>
            <Grid.Item span={2}>
              <div className={style.lala}>
                <div className="hop1">{hoplist[0]?.hospitalName}</div>
                <Ellipsis
                  direction="end"
                  rows={2}
                  content={hoplist[0]?.brief}
                />
              </div>
            </Grid.Item>
          </Grid>
        </div>
        <Divider></Divider> */}
      {/* </Card> */}
      {hoplist?.map((item) => {
        return (
            <Card key={item.id} onClick={() => {
                btn1(item.id)

          }}>
            <div>
              <Grid columns={3} gap={8}>
                <Grid.Item>
                  <img src={"/api" + item.imgUrl} className={style.img}></img>
                </Grid.Item>
                <Grid.Item span={2}>
                  <div className={style.lala}>
                    <div className="hop1">{item.hospitalName}</div>
                                <Ellipsis direction="end" rows={2} content={item.brief.slice(3)} />
                                <Rate readOnly value={item.level} />
                  </div>
                </Grid.Item>
              </Grid>
            </div>
            <Divider></Divider>
          </Card>
        );
      })}
    </div>
  );
};
